package cn.lixin.hrm.client;

import cn.lixin.hrm.domain.LoginUser;
import cn.lixin.hrm.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class LoginUserFallbackFactory implements FallbackFactory<LoginUserFeignClient>{

    @Override
    public LoginUserFeignClient create(Throwable throwable) {
        return new LoginUserFeignClient() {
            @Override
            public AjaxResult entering(LoginUser loginUser) {
                return AjaxResult.me().setSuccess(false).setMessage("对不起,机构入驻失败");
            }

            @Override
            public AjaxResult register(LoginUser loginUser) {
                return AjaxResult.me().setSuccess(false).setMessage("对不起,注册失败");
            }
        };
    }
}
